const Nightmare = require('nightmare')

//屏幕宽度尺寸 1920x1080、1600x900、800x600

const nightmare = Nightmare({ show: false, width: 1920, height:1080 })

const currentData = Math.floor(Date.now())

// 'https://www.baidu.com/'

const myUrl = "https://www.csdn.net/"
const prefixName = myUrl.split(".")[1]

//console.log(prefixName)

nightmare
  .goto(myUrl)
  .screenshot(prefixName + '-' + currentData + '.png')
  .end()
  //.then(console.log)
  .catch(error => {
    console.error('screenshot failed:', error)
  })

